class Solution:
    def compareVersion(self, version1: str, version2: str) -> int:
        list1, list2 = version1.split("."), version2.split(".")
        length = max(len(list1), len(list2))
        for i in range(length):
            try:
                list1[i] = int(list1[i])
            except:
                list1.append(0)
            try:
                list2[i] = int(list2[i])
            except:
                list2.append(0)
            if list1[i] > list2[i]:
                return 1
            elif list1[i] < list2[i]:
                return -1
        else:
            return 0


a = Solution()
print(a.compareVersion(version1="0.1", version2="1.1"))  # -1
print(a.compareVersion(version1="1.0.1", version2="1"))  # 1
print(a.compareVersion(version1="7.5.2.4", version2="7.5.3"))  # -1
print(a.compareVersion(version1="1.01", version2="1.001"))  # 0
print(a.compareVersion(version1="1.0", version2="1.0.0"))  # 0
print(a.compareVersion(version1="1.2", version2="1.10"))  # -1
